/* main.cc 
   Written by, Sohail Qayum Malik[sqm@cyberian.pk] */

#include "main.hh"

int main(int argc, char* argv[]) {

   argument<arg_history>::pointer ptr;

   try {
   
      ptr = argument<arg_history>::NewE(argc, argv, COMMANDS);
      
      argument<arg_history>::iterator itB(ptr->begin());
      argument<arg_history>::iterator itE(ptr->end());
      
      if ( itB(HELP) ) {
         
         std::cout<<"Help!"<<std::endl;
      }
      
      if ( itB(VERSION) ) {
      
         std::cout<<"Version!"<<std::endl;
      }
      
      cc_tokenizer::String<char> go = cooked_read("Grammar/Grammar");
      cc_tokenizer::grammar_parser<cc_tokenizer::String<char>, char> obj(go);

      //obj.go_to_next_line();
      //std::cout<<obj.get_current_line().c_str()<<std::endl;
      //cc_tokenizer::String<char> aLine(obj.get_current_line().c_str());
      //std::cout<<"Size = "<<aLine.size()<<std::endl;
      //cc_tokenizer::String<char> aLastLine(obj.get_line_by_number(5).c_str());
      //std::cout<<obj.get_current_line().c_str()<<std::endl;
      //std::cout<<"Size = "<<aLastLine.size()<<std::endl;




      //const char* ptr = obj.get_current_line().c_str();

      
      while ( obj.go_to_next_line() != cc_tokenizer::string_character_traits<char>::eof() ) { 
      
         std::cout<<obj.get_current_line().c_str()<<std::endl;
      }
      
      std::cout<<obj.get_total_number_of_lines()<<std::endl;
      
      std::cout<<obj.get_current_line().c_str()<<std::endl;
      
      std::cout<<obj.get_line_by_number(1).c_str()<<std::endl;
      std::cout<<obj.get_line_by_number(5).c_str()<<std::endl;
      std::cout<<obj.get_line_by_number(1).c_str()<<std::endl; 
   }
   catch(ala_exception& e) {
   
      std::cout<<e.what()<<std::endl;
   }
   catch(args_exception& e) {
   
      std::cout<<e.what()<<std::endl;
   }

   return 0;
}
